<?php

namespace app\controller;

use plugin\saiadmin\app\logic\system\SystemUserLogic;
use support\Request;

class LoginController
{
    public function login(Request $request)
    {
        $username = $request->post('username','admin');
        $password = $request->post('password','123456');
        $type = $request->post('type', 'pc');
        if(!$username||!$password){
            return json(['code' => 400, 'msg' => '用户名或密码不能为空']);
        }
        $logic = new SystemUserLogic();
        $data = $logic->login($username, $password, $type);
        return json(['code' => 200, 'data' => $data]);
    }

}
